﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class Alert
    {
        public long alert_id;
        public AlertType alert_type;
        public string alert_description;
        public AlertStatus alert_status;
        public DateTime alert_date = DateTime.Now;
        public DateTime alert_modified_date = DateTime.Now;
        public string alert_key;
        public string entity;

        public Alert(AlertType alertType, string alertDescription, AlertStatus alertStatus, string alertKey, string entityF) 
        {
            alert_type = alertType;
            alert_description = alertDescription;
            alert_status = alertStatus;
            alert_key = alertKey;
            entity = entityF;
        }
        public Alert(SqlDataReader rd)
        {
            alert_id = Convert.ToInt32(rd["alert_id"]);
            alert_type = rd["alert_type"] is DBNull ? AlertType.SOFTMAR_COMMISSION_INVOICE_TCRELET : (AlertType)Enum.Parse(typeof(AlertType), rd["alert_type"].ToString());
            alert_description = rd["alert_description"] is DBNull ? "" : rd["alert_description"].ToString();
            alert_status = rd["alert_status"] is DBNull ? AlertStatus.PENDING : (AlertStatus)Enum.Parse(typeof(AlertStatus), rd["alert_status"].ToString());
            alert_date = rd["alert_date"] is DBNull ? new DateTime(2001, 1, 1) : Convert.ToDateTime(rd["alert_date"]);
            alert_modified_date = rd["alert_modified_date"] is DBNull ? new DateTime(2001, 1, 1) : Convert.ToDateTime(rd["alert_modified_date"]);
            alert_key = rd["alert_key"] is DBNull ? "" : rd["alert_key"].ToString();
            entity = rd["entity"] is DBNull ? "" : rd["entity"].ToString();
        }
    }
    public enum AlertType
    {
        VESSEL,
       // SOFTMAR,
        SOFTMAR_COMMISSION_INVOICE_TCRELET,
        SOFTMAR_COMMISSION_INVOICE_VOYAGE_CARGO_RELET,
        SOFTMAR_FREIGHT_HIRE_INVOICE,
        SOFTMAR_BUNKER_PROCUREMENT_PO,
        SOFTMAR_BUNKER_GRN,
        SOFTMAR_STATEMENT,
        SOFTMAR_VOYAGE_MASTER,
        WIN_SDS_PO,
        WIN_SDS_GRN,
        CREW_PAYROLL,
        DA_DESK
    }
    public enum SoftmarType
    {
        SOFTMAR_COMMISSION_INVOICE_TCRELET,
        SOFTMAR_COMMISSION_INVOICE_VOYAGE_CARGO_RELET,
        SOFTMAR_PROFORMA,
        SOFTMAR_FREIGHT_HIRE_INVOICE,
        SOFTMAR_BUNKER_PROCUREMENT_PO,
        SOFTMAR_BUNKER_GRN,
    }
    public enum AlertStatus
    {
        PENDING,
        RESOLVED
    }
}
